package com.example.car.manager;

import java.util.ArrayList;

import android.app.Activity;

public class ActivityCollector {
	public static ArrayList<Activity> activitys=new ArrayList<Activity>();
	public static void addActivity(Activity activity){
		if(!activitys.contains(activity)){
			activitys.add(activity);
		}
		
	}
	public static void RemoveActivity(Activity activity){
		if(!activitys.contains(activity)){
			activitys.remove(activity);
		}
		
	}
	public static void finishActivity(String ActivityName){
		for (Activity activity : activitys) {
			if(ActivityName.equals(activity.getClass().getSimpleName())){
				activity.finish();
			}
		}
	}

	public static void finishActivity(Activity activity){
		if(activitys.contains(activity)){
			activitys.remove(activity);
		}
		
	}
	public static int size(){
		return activitys.size();
	}
	public static void finishActivity(){
		for (Activity activity : activitys) {
			if(!activity.isFinishing()){
				activity.finish();
			}
				
		}
		System.exit(0);
	}


}
